.. _control-cubrid-processes: Controlling CUBRID Processes ============================ CUBRID processes can be controlled by **cubrid** utility. Controlling CUBRID Service -------------------------- The following **cubrid** utility syntax shows how to control services registered in the configuration file. One of the following can be specified in : **start**, **stop**, **restart**, or **status**; **start** is used to run services; **stop** is used to stop services; **restart** is used to restart services; **status** is used to check status. No additional options or arguments are required. :: cubrid service : {start|stop|restart|status} Controlling Database Server --------------------------- The following **cubrid** utility syntax shows how to control database server process. One of the following can be specified in : **start** is used to run services; **stop** is used to stop services; **restart** is used to restart services; **status** is used to check status. Every command except **status** must have a database name as an argument. :: cubrid server [database_name] : {start|stop|restart|status} Controlling Broker ------------------ The following **cubrid** utility syntax shows how to control CUBRID broker process. One of the following can be specified in : **start** is used to run services; **stop** is used to stop services; **restart** is used to restart services; **status** is used to check status; **acl** is used to limit broker access; **on**/**off** is used to enable/disable the specified broker; **reset** is used to reset the connection to broker; **info** is used to display the broker configuration information; **getid** is used to get the SHARD ID(SHARD database ID) with SHARD key. And more, SHARD feature can be used only after the broker is started and "SHARD", the broker parameter, whose value in cubrid_broker.conf is set to ON. :: cubrid broker : start |stop |restart |status [options] [broker_name_expr] |acl {status|reload} broker_name |on |off |reset broker_name |info |getid -b [-f] shard_key Controlling CUBRID Manager Server --------------------------------- To use the CUBRID Manager, the Manager server must be running where database server is running. The following **cubrid** utility syntax shows how to control the CUBRID Manager processes. :: cubrid manager : {start|stop|status} One of the following can be specified in *command*: **start**, **stop**, or **status**; **start** is used to run services; **stop** is used to stop services; **status** is used to check status. Controlling CUBRID HA --------------------- The following **cubrid heartbeat** utility syntax shows how to use CUBRID HA. One of the following can be specified in *command*. :: cubrid heartbeat : {start|stop|copylogdb|applylogdb|reload|status} * start: start HA-related processes. * stop: stop HA-related processes. * copylogdb: start or stop copylogdb process. * applylogdb: start or stop applylogdb process. * reload: reload information on HA configuration. * status: check HA status. For details, see :ref:`cubrid-heartbeat`. .. _control-cubrid-services: CUBRID Services =============== Registering Services -------------------- You can register database servers, CUBRID brokers, CUBRID Manager(s) or CUBRID HA as CUBRID service in the configuration file ( **cubrid.conf** ). To register services, you can input for each **server**, **broker**, **manager** or **heartbeat** as a parameter value, and it is possible to input several values by concatenating them in comma(,). If you do not register any service, only master process is registered by default. It is convenient for you to view status of all related processes at a glance or start and stop the processes at once with the **cubrid** **service** utility once it is registered as CUBRID service. For details on CUBRID HA configuration, see :ref:`cubrid-service-util`. The following example shows how to register database server and broker as service in the **cubrid.conf** file and enable databases ( *demodb* and *testdb* ) to start automatically at once when CUBRID server starts running. :: # cubrid.conf ... [service] # The list of processes to be started automatically by 'cubrid service start' command # Any combinations are available with server, broker, manager and heartbeat. service=server,broker # The list of database servers in all by 'cubrid service start' command. # This property is effective only when the above 'service' property contains 'server' keyword. server=demodb,testdb Starting Services ----------------- In Linux environment, you can enter the code below to start CUBRID after installation. If no server is registered in the configuration file, only master process (cub_master) runs by default. In the Windows environment, the code below is normally executed only if a user with system permission has logged in. An administrator or general user can start or stop the CUBRID server by clicking its icon on the taskbar tray. :: % cubrid service start @ cubrid master start ++ cubrid master start: success The following message is returned if master process is already running. :: % cubrid service start @ cubrid master start ++ cubrid master is running. The following message is returned if master process fails to run. The example shows that service fails to start due to conflicts of the **cubrid_port_id** parameter value specified in the cubrid.conf file. In such a case, you can resolve the problem by changing the port. If it fails to start even though no port is occupied by process, delete /tmp/CUBRID1523 file and then restart the process. :: % cubrid service start @ cubrid master start cub_master: '/tmp/CUBRID1523' file for UNIX domain socket exist.... Operation not permitted ++ cubrid master start: fail After registering service as explained in :ref:`control-cubrid-services`, enter the code below to start the service. You can verify that database server process and broker as well as registered *demodb* and *testdb* are starting at once. :: % cubrid service start @ cubrid master start ++ cubrid master start: success @ cubrid server start: demodb This may take a long time depending on the amount of restore works to do. CUBRID 9.2 ++ cubrid server start: success @ cubrid server start: testdb This may take a long time depending on the amount of recovery works to do. CUBRID 9.2 ++ cubrid server start: success @ cubrid broker start ++ cubrid broker start: success Stopping Services ----------------- Enter code below to stop CUBRID service. If no services are registered by a user, only master process stops and then restarts. :: % cubrid service stop @ cubrid master stop ++ cubrid master stop: success Enter code below to stop registered CUBRID service. You can verify that server process, broker process, and master process as well as *demodb* and *testdb* stop at once. :: % cubrid service stop @ cubrid server stop: demodb Server demodb notified of shutdown. This may take several minutes. Please wait. ++ cubrid server stop: success @ cubrid server stop: testdb Server testdb notified of shutdown. This may take several minutes. Please wait. ++ cubrid server stop: success @ cubrid broker stop ++ cubrid broker stop: success @ cubrid master stop ++ cubrid master stop: success Restarting Services ------------------- Enter code below to restart CUBRID service. If no services are registered by a user, only master process stops and then restarts. :: % cubrid service restart @ cubrid master stop ++ cubrid master stop: success @ cubrid master start ++ cubrid master start: success Enter code below to restart registered CUBRID service. You can verify that server process, broker process, and master process as well as *demodb* and *testdb* stop and then restart at once. :: % cubrid service restart @ cubrid server stop: demodb Server demodb notified of shutdown. This may take several minutes. Please wait. ++ cubrid server stop: success @ cubrid server stop: testdb Server testdb notified of shutdown. This may take several minutes. Please wait. ++ cubrid server stop: success @ cubrid broker stop ++ cubrid broker stop: success @ cubrid master stop ++ cubrid master stop: success @ cubrid master start ++ cubrid master start: success @ cubrid server start: demodb This may take a long time depending on the amount of recovery works to do. CUBRID 9.3 ++ cubrid server start: success @ cubrid server start: testdb This may take a long time depending on the amount of recovery works to do. CUBRID 9.3 ++ cubrid server start: success @ cubrid broker start ++ cubrid broker start: success Managing Service Status ----------------------- The following example shows how to check the status of master process and database server registered. :: % cubrid service status @ cubrid master status ++ cubrid master is running. @ cubrid server status Server testdb (rel 9.2, pid 31059) Server demodb (rel 9.2, pid 30950) @ cubrid broker status % query_editor ---------------------------------------- ID PID QPS LQS PSIZE STATUS ---------------------------------------- 1 15465 0 0 48032 IDLE 2 15466 0 0 48036 IDLE 3 15467 0 0 48036 IDLE 4 15468 0 0 48036 IDLE 5 15469 0 0 48032 IDLE % broker1 OFF @ cubrid manager server status ++ cubrid manager server is not running. The following message is returned if master process has stopped. :: % cubrid service status @ cubrid master status ++ cubrid master is not running. .. _cubrid-utility-logging: cubrid Utility Logging ---------------------- CUBRID supports a logging feature about cubrid utility's running result. **Logging contents** The following contents are written to the $CUBRID/log/cubrid_utility.log file. * All commands through cubrid utilities: only usage, version and parsing errors are not logged. * Execution results by cubrid utilities: success/failure. * An error message when failure. **Log file size** A size of cubrid_utility.log file is expanded by the size specified by **error_log_size** parameter in cubrid.conf; if this size is enlarged as the specified size, it is backed up as the cubrid_utility.log.bak file. **Log format** ::